package com.test.condition;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/11/27 19:08
 * <p>
 * 自定义逻辑返回需要导入的组件
 */
public class MyImportSelector implements ImportSelector {

    /**
     * AnnotationMetadata:当前标注@Import注解的类的所有注解信息
     *
     * @param importingClassMetadata
     * @return
     */
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        //方法不要返回null
        return new String[]{"com.test.bean.Blue", "com.test.bean.Yellow"};
    }
}
